import request from '@/utils/request'

// Post /admin/acl/index/login
// GET /admin/acl/index/info
// POST /admin/acl/index/logout

export interface userinfoModel{
    avatar:string,
    buttons:string[],
    name:string,
    roles:string[],
    routes: string[]

}

// 返回值的类型 
export interface tokenModel {
    token:string
}

export interface loginModel {
    username:string,
    password:string
} 

export default {
    // 登录
    login(data:loginModel){
        return request.post<any,tokenModel>(`/admin/acl/index/login`,data)
    },
    // 获取用户信息
    getInfo(){
        return request.get<any,userinfoModel>(`/admin/acl/index/info`)
    },
    // 退出登录
    logout(){
        return request.post<any,null>(`/admin/acl/index/logout`)
    }
}